home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / patches / pgs3h21d.lha / 3.0h2update / Macros.LHA / SendtoProVector.rexx < prev    next >
OS/2 REXX Batch file  |  1995-07-13  |  5KB  |  168 lines

  1. /* $VER: SendtoProVector.rexx 1.0 (07.07.95)
  2.    Based on "SendtoBME.rexx" 
  3.    Modified for ProVector® by Jeff Blume - Stylus, Inc.
  4.  
  5.    "SendtoBME.rexx" Copyright 1995 Soft-Logik Publishing Corporation
  6.    May not be distributed without Soft-Logik Publishing Corporation's express written permission.
  7.    Permission is granted to include this script with ProVector.
  8. */
  9.  
  10. OPTIONS RESULTS
  11. TRACE OFF
  12.  
  13. /* Make sure rexx support is opened */
  14. IF ~SHOW('L','rexxsupport.library') THEN
  15.    CALL ADDLIB('rexxsupport.library',0,-30)
  16.  
  17. ADDRESS 'PAGESTREAM'
  18.  
  19. /* Check and see if one drawing is selected */
  20. getobject type objtype
  21. if objtype~=2 then do
  22.     ADDRESS 'PAGESTREAM'
  23.     allocarexxrequester '"Send to ProVector Error!"' 368 59
  24.     reqhandle=result
  25.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  26.         Exithandle=result
  27.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'One drawing must be selected to edit in ProVector.'"
  28.     addarexxgadget reqhandle TEXT 8 20 352 border none string "'Select only one drawing and try again.'"
  29.     doarexxrequester reqhandle
  30.     freearexxrequester reqhandle
  31.     EXIT
  32. end
  33.  
  34. /* Export the drawing to a temp file */
  35. 'lockinterface true'
  36. 'exportgraphic file t:HotLinkedDrawing filter iffdr2d status force'
  37. /* Eventually will just make drawing external, but not this version */
  38. /* 'editpicture external file t:HotLinkedDrawing' */
  39. 'refresh wait'
  40.  
  41. /* set the default ProVector path */
  42. call pragma('W', 'Null')    /* So DOS requester suppressed, sans PV: assignment */
  43. PVpath='PV:ProVector'
  44. preffile='PageStream3:SendtoProVector.prefs'
  45.  
  46. /* If ProVector doesn't exist in the default path, check SendtoProVector.prefs */
  47. if ~exists(PVpath) then do
  48.     if open(.ifile, preffile, 'R') then do
  49.         PVpath=readln(.ifile)
  50.         call close(.ifile)
  51.         askuser='no'
  52.         end
  53.     else do
  54.         askuser='yes'
  55.     end
  56.     /* If ProVector doesn't exist in the set pref path, ask the user where it is */
  57.     if ~exists(PVpath) | askuser='yes' then do
  58.         getfile TITLE "'Please locate ProVector'" load path "'PageStream3:'" file ProVector posbutton 'Ok' negbutton 'Cancel'
  59.         if RC=10 then signal cancel
  60.         PVpath=result
  61.         if open(.ifile, preffile, 'W') then do
  62.             call writeln(.ifile, PVpath)
  63.             call close(.ifile)
  64.         end
  65.     end
  66. end
  67.  
  68. /* Run ProVector after setting path to ProVector path for PROGDIR: references */
  69. FNameIdx = LastPos("/",PVPath)    /* Index to simple filename */
  70. if FNameIdx = 0 then FNameIdx = lastpos(":",PVPath)
  71. PVDir = Left(PVPath,(FNameIdx -1))
  72. call Pragma('D',PVDir)
  73. call Pragma('S',8000)
  74. if ~show(P, 'ProVector') then ADDRESS COMMAND 'run >nil:' PVpath "AskRes=False"
  75.  
  76. /* Wait until the ARexx port shows up */
  77. do 20
  78.     if ~show(P, 'ProVector') then call delay(50)
  79. end
  80.  
  81. /* If the ARexx port didn't show up, alert the user and exit */
  82. if ~show(P, 'ProVector') then do
  83.     ADDRESS 'PAGESTREAM'
  84.     allocarexxrequester '"Send to Editor Error!"' 368 59
  85.     reqhandle=result
  86.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  87.         Exithandle=result
  88.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'ProVector could not be started.'"
  89.     doarexxrequester reqhandle
  90.     freearexxrequester reqhandle
  91.     'refresh continue'
  92.     'lockinterface false'
  93.     EXIT
  94. end
  95.  
  96. /* Obviously, this won't always go to the ProVector screen, but since 'screentofront'
  97.    has no equivalent in ProVector... (yes, there should be - JB) */
  98. 'ScreenToBack'
  99.  
  100. ADDRESS 'ProVector'
  101. 'Lock Wait'
  102. 'Open T:HotLinkedDrawing'
  103. 'GetBool "Save & close to update PageStream." "OK" "OK"'
  104. 'UnLock'
  105.  
  106. /* While the user is in ProVector, let's get some info about the pic from PageStream */
  107. ADDRESS 'PAGESTREAM'
  108. getpicture position pstem frame fflag contentoffset cstem contentscale cstem rotation rstem about rstem constrain cflag print pflag
  109. gettextwrap region wmode wrap wtype standoff wstem
  110.  
  111. /* Wait for the user to finish in ProVector */
  112. ADDRESS 'ProVector'
  113. do forever
  114.     if ~show(P, 'ProVector') then signal update
  115.     if GetDrawing() then call Delay(50)
  116.     else signal UpDate
  117. end
  118.  
  119. /* update PGS and exit */
  120. UPDATE:
  121. ADDRESS 'PAGESTREAM'
  122. 'screentofront'
  123. /* Eventually will just make picture external, but not this version */
  124. /* 'editpicture path T:HotLinkedDrawing' */
  125. /* 'editpicture internal' */
  126.  
  127. 'deleteobject'
  128. 'placegraphic file T:HotLinkedDrawing filter IFFDR2D'
  129. editpicture position pstem.left pstem.top pstem.right pstem.bottom skew rstem.slant rstem.twist
  130. if fflag=ON then editpicture framed contentoffset cstem.x cstem.y contentscale cstem.h cstem.v
  131. settextwrap wmode standoff wstem.x wstem.y wtype
  132. /* Next clause not really needed, since UpDate has no return statement */
  133. signal cancel
  134.  
  135. CANCEL:
  136. ADDRESS 'PAGESTREAM'
  137. 'refresh continue'
  138. 'lockinterface false'
  139. ADDRESS COMMAND
  140. 'delete T:HotLinkedDrawing'
  141. EXIT
  142.  
  143.  
  144. GETDRAWING:
  145.     /* See if user still has drawing open */
  146.     'Lock'; if RC ~= 0 then return 1
  147.     'FirstProj'; ProjPtr = Result
  148.     'ProjName' ProjPtr
  149.     if Result = "T:HOTLINKEDDRAWING" then do
  150.         'UnLock'
  151.         return 1
  152.     end
  153.     else do i=1
  154.         'NextProj' ProjPtr
  155.         if Result = 0 then do
  156.             'UnLock'
  157.             return 0
  158.         end
  159.         ProjPtr = Result
  160.         'ProjName' ProjPtr
  161.         if Result = "T:HOTLINKEDDRAWING" then do
  162.             'UnLock'
  163.             return 1
  164.         end
  165.     end
  166.     'UnLock'
  167. return
  168.